/**
 * There are <a href="https://www.hdzhx.com">邯郸智讯</a> code generation
 */
package com.boxin.ims.modules.wechat.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.boxin.ims.modules.momarketing.entity.QRCode;
import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 会员金额Entity
 * @author zhangshanshan
 * @version 2014-12-18
 */
@Entity
@Table(name = "wp_member_money")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class MemberMoney extends BaseEntity {
	
	public final static String TYPE_RECHARGE = "0";				//充值
	public final static String TYPE_CONSUME = "1";				//消费
	public final static String TYPE_PAYMONEY = "2";				//消费-二维码支付
	public final static String TYPE_EXCEPTION = "3";			//异常
	public final static String TYPE_CASHBACK = "5";			//返利
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private WechatMember wechatMember;	//所属会员
	private String type;	//类型【1为冲值、2为消费   4：无效或异常 5返利】
	private String serialNo;			//流水号
	private String manner;	//方式【如果是冲值的话：支付宝、微信 , 如果是消费的话：洗车、打腊、保养等等】
	private Integer money;	//金额
	private Date createTime;	// 创建日期
	private Date updateTime;	//更新
	private String remarks; // 备注
	private QRCode qrCode;//
	private String delFlag;
	
	
	private String day;
	private String month;
	private String year;

	public MemberMoney() {
		this.createTime = new Date();
		this.delFlag=MemberMoney.DEL_FLAG_NORMAL;
	}

	public MemberMoney(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_wechat_memberMoney")
	//@SequenceGenerator(name = "seq_wechat_memberMoney", sequenceName = "seq_wechat_memberMoney")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@ManyToOne
	@JoinColumn(name="wechat_member_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public WechatMember getWechatMember() {
		return wechatMember;
	}

	public void setWechatMember(WechatMember wechatMember) {
		this.wechatMember = wechatMember;
	}
	
	@NotNull
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getManner() {
		return manner;
	}

	public void setManner(String manner) {
		this.manner = manner;
	}

	public Integer getMoney() {
		return money;
	}

	public void setMoney(Integer money) {
		this.money = money;
	}


	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	

	public String getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getDay() {
		return day;
	}

	public void setDay(String day) {
		this.day = day;
	}

	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}
	
	@ManyToOne
	@JoinColumn(name="qrcode_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public QRCode getQrCode() {
		return qrCode;
	}

	public void setQrCode(QRCode qrCode) {
		this.qrCode = qrCode;
	}

	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}
	
}


